package org.lh.ibernate.core.impl;

import org.lh.ibernate.annotation.CaCheKey;
import org.lh.ibernate.annotation.EnableCaChe;
import org.lh.ibernate.core.ICacheHandle;

public class CaCheHandle implements ICacheHandle {
    @Override
    public  boolean isSupportCache(Class clazz) {
        if(clazz.isAnnotationPresent(EnableCaChe.class)){
            EnableCaChe enableCaChe= (EnableCaChe) clazz.getAnnotation(EnableCaChe.class);
            String cacheType=enableCaChe.type();
//            System.out.println(cacheType);
            return (cacheType.equals("redis"))?true:false;
        }
        return false;
    }



    //todo
    public boolean isContainCacheKey(Class clazz){
        if(clazz.isAnnotationPresent(CaCheKey.class)){
            CaCheKey caCheKey= (CaCheKey) clazz.getAnnotation(CaCheKey.class);
            String key=caCheKey.value();
            return (!key.equals(""))?true:false;
        }
        return false;
    }
}
